import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GroundTypeVO, GroundTypeForm, GroundTypeQuery } from '@/api/system/groundType/types';

/**
 * 查询地面类型列表
 * @param query
 * @returns {*}
 */

export const listGroundType = (query?: GroundTypeQuery): AxiosPromise<GroundTypeVO[]> => {
  return request({
    url: '/system/groundType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询地面类型详细
 * @param id
 */
export const getGroundType = (id: string | number): AxiosPromise<GroundTypeVO> => {
  return request({
    url: '/system/groundType/' + id,
    method: 'get'
  });
};

/**
 * 新增地面类型
 * @param data
 */
export const addGroundType = (data: GroundTypeForm) => {
  return request({
    url: '/system/groundType',
    method: 'post',
    data: data
  });
};

/**
 * 修改地面类型
 * @param data
 */
export const updateGroundType = (data: GroundTypeForm) => {
  return request({
    url: '/system/groundType',
    method: 'put',
    data: data
  });
};

/**
 * 删除地面类型
 * @param id
 */
export const delGroundType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/groundType/' + id,
    method: 'delete'
  });
};
